import {useStore} from "vuex";

/**
 * 鉴权
 *
 * @param permission
 */
export const hasPermission = (permission: string): boolean => {
  const store = useStore();
  const permissionList = store.getters.getPermissionList;
  const find = permissionList.find(item => item === permission);
  return Boolean(find);
}

/**
 * 鉴权
 *
 * @param role
 */
export const hasRole = (role: string): boolean => {
  const store = useStore();
  let roleList = store.getters.getRoleList;
  const find = roleList.find(item => item === role);
  return Boolean(find);
}

export const system = {
  user: {
    userStatus: {
      page: "system:user:userStatus:page",
    }
  },
};
